Multi-sampling anti-aliasing (MSAA) improves the visual quality of the images rendered using a graphics processor. In MSAA, multiple visibility samples, color, and depth samples are used per pixel. However, during the rendering of a triangle, the pixel shader is only executed once per pixel. A common use case is 4× MSAA, where there are four times as many samples per pixel compared to the usual case of one sample per pixel. The color buffer bandwidth may increase by a factor of N for N× MSAA in a naïve setting. Therefore, the MSAA color buffers are compressed.
One way to compress MSAA color buffers is to split the colors into N different planes for N× MSAA, and always fill plane 0 first and continue with the other planes after that. Each pixel also needs log 2(N) bits, called index bits, to “point” to a color in the N different planes. For example, with 4× MSAA, each sample needs 2 index bits to point to a color being located in one of the 4 planes. For a tile of 8×4 pixels with 4 samples per pixel (and two bits per sample), 256 index bits (2*4*8*4) are needed.
If a pixel is completely inside the triangle being rendered, then all samples will get the same color, and the index bits will then be all zeroes (because they will all point to color plane 0) for all samples, and nothing will be stored in the remaining planes. In many cases, only plane 0 will be used, and the remaining planes will be used more and more depending on the complexity of the geometry being rendered into a tile (e.g., 8×4 pixels).
If a color plane is empty for a certain tile, then there is no need to write that content to memory on a cache evict, and there is no need to read it either, when the color content for a tile is requested. Hence, this is a type of compression. However, one can also apply compression to the color planes when they are evicted from the color cache.
For each tile, a small number of bits (e.g., 4) are stored to indicate which state the tile is in. These bits can be used to indicate that the tile is cleared, or that plane 0 is compressed, while plane 1 is not, etc. For one render target, all these bits are called the control surface.